<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
	<script src="https://cdn.staticfile.org/jquery/3.7.1/jquery.min.js"></script>
	<script src="https://cdn.staticfile.org/axios/1.7.2/axios.min.js"></script>
    <title>批量评测</title>
</head>
<body>
    <main>
        <div>
            比赛 {{ id }} 批量评测
        </div>
        <div>
            <input id="file_input" type="file" accept=".zip"/>
			<button onclick="javascript:upload()">上传</button>
		</div>
    </main>
</body>
<script>
	function upload()
	{
		const reader = new FileReader();
		const file = $("#file_input")[0].files[0];
        const contestId = window.location.href.match(/\/contest\/(\S*)\/psub/)[1];
		reader.onload = function (e) {
            axios.post(`/contest/${contestId}/psub`,{
                action: "upload_package",
                data: e.target.result
            }).then((res)=>
            {
                console.log(res.data);
            })
		}
		reader.readAsArrayBuffer(file);
	}
</script>
</html>